const app = getApp()
if (!app.globalData) app.globalData = {}

function observer(key) {
  return {
    get() {
      const data = app.globalData[key]
      if (!data) app.globalData[key] = {}
      return app.globalData[key]
    },
    set(data) {
      app.globalData[key] = data
      return data
    },
    clear() {
      this.set({})
    }
  }
}

export const temaiParams = observer('temaiParams')

// const params = temaiParams.get(); temaiParams.set({a: 1}); temaiPrams.clear()
